<template>
  <a-modal style="top: 10px;" :bodyStyle="{ padding: '0', 'max-height': '80vh', 'overflow-y': 'auto' }" :title="title" :width="1200" :maskClosable="false" :visible="visible" @cancel="visible = false" :button_loading="button_loading">
    <a slot="footer">
      <a-button v-if="cancelText" @click="visible = false">{{ cancelText }}</a-button>
      <a-button v-if="okText == '保存'" type="primary" :loading="button_loading" @click="handleSubmit">{{ okText }}</a-button>
      <a-button v-if="okText == '关闭'" type="primary" @click="visible = false">{{ okText }}</a-button>
    </a>
    <!-- <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="学生信息" key="1"> -->
    <a-spin :indicator="indicator" :spinning="spinning" :tip="tip">
      <div class="spin-content">
        <a-form :form="form" :labelAlign="'left'" :selfUpdate="true">
          <a-tabs v-model="activeKey" :tab-position="'left'">
            <a-tab-pane forceRender :key="1" tab="基本信息">
              <a-card :bordered="false" size="small">
                <!-- <div slot="title" class="card_title">基本信息:</div> -->
                <a-row :gutter="24">
                  <a-col :md="18" :sm="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                    <a-row :gutter="24">
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="编号">
                          <a-input v-decorator="['Code']" :placeholder="CodeDisabled ? '自动编号' : ''" :disabled="CodeDisabled" />
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="咨询时间">
                          <a-date-picker v-decorator="['ConsultationTime']" style="width: 100%;" :placeholder="actionType == 'view' ? '' : '请选择日期...'" />
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="咨询来源">
                          <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['ConsultationSrc']">
                            <a-select-option v-for="(item, index) in ZXDrop" :key="item.ID" :value="item.ID">
                              {{ item.Title }}
                            </a-select-option>
                          </a-select>
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="未入学动态">
                          <a-select allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['NonEnrollmen']">
                            <a-select-option v-for="(item, index) in WRXDrop" :key="item.ID" :value="item.ID">
                              {{ item.Title }}
                            </a-select-option>
                          </a-select>
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="姓名">
                          <a-input v-decorator="['name', { rules: [{ required: true, message: '请填写姓名!' }] }]" />
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="身份证号">
                          <a-input v-decorator="['IDNumber', { rules: [{ validator: idCardCheck.bind(this), message: '请填写身份证!' }] }]" @change="idCardChange" />
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="性别">
                          <a-select allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['sex', { rules: [{ required: true, message: '请填写性别!' }] }]">
                            <a-select-option :value="1">男</a-select-option>
                            <a-select-option :value="0">女</a-select-option>
                          </a-select>
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="出生年月">
                          <a-date-picker v-decorator="['birthday', { rules: [{ required: true, message: '请填写出生年月!' }] }]" style="width: 100%;" :placeholder="actionType == 'view' ? '' : '请选择日期...'" />
                        </a-form-item>
                      </a-col>
                      <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="民族">
                          <a-select allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['nation', { initialValue: 2356 }]">
                            <a-select-option v-for="(item, index) in MZDrop" :key="item.ID" :value="item.ID">
                              {{ item.Title }}
                            </a-select-option>
                          </a-select>
                        </a-form-item>
                      </a-col>
                      <!-- <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="身高(cm)">
                          <a-input-number v-decorator="['height']" style="width:100%" />
                        </a-form-item>
                      </a-col> -->
                      <!-- <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="体重(kg)">
                          <a-input-number v-decorator="['weight']" style="width:100%" />
                        </a-form-item>
                      </a-col> -->
                      <!-- <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="民族">
                          <a-select allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['nation', { initialValue: 2356 }]">
                            <a-select-option v-for="(item, index) in MZDrop" :key="item.ID" :value="item.ID">
                              {{ item.Title }}
                            </a-select-option>
                          </a-select>
                        </a-form-item>
                      </a-col> -->
                      <!-- <a-col :md="8" :sm="24">
                        <a-form-item v-bind="formItemLayout" label="血型">
                          <a-input v-decorator="['bloodType']" />
                        </a-form-item>
                      </a-col> -->
                    </a-row>
                  </a-col>
                  <a-col :md="6" :sm="24">
                    <a-row>
                      <div class="clearfix" style="height:120px;width:250px;padding-left:60px" v-if="actionType == 'edit' || actionType == 'add'">
                        <a-upload name="avatar" listType="picture-card" class="avatar-uploader" :showUploadList="false" :action="a" :headers="headers" :beforeUpload="beforePhotoUpload" @change="handlePhotoChange">
                          <a-popover placement="right">
                            <template slot="content">
                              <a-button @click="removePhotoUrl" type="danger" size="small">删除</a-button>
                              <a-button @click="viewPhoto(1)" type="primary" style="margin-left:5px" size="small">查看大图</a-button>
                            </template>
                            <img v-if="PhotoUrl" style="height:104px" :src="PhotoUrl" alt="avatar" />
                          </a-popover>
                          <div v-if="!PhotoUrl">
                            <a-icon :type="Photoloading ? 'loading' : 'plus'" />
                            <div class="ant-upload-text">头像上传</div>
                          </div>
                        </a-upload>
                      </div>
                      <div style="text-align: center;" v-if="filePhoto">
                        <img v-if="filePhoto != null" :src="filePhoto" alt="avatar" style="width: 100px; height: 130px;" />
                      </div>
                    </a-row>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="12" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="籍贯">
                      <a-cascader :options="options_nativePlace" :load-data="loadDataNativePlace" :placeholder="actionType != 'view' ? '请选择地址...' : ''" change-on-select v-decorator="['NativePlaceValue', { rules: [{ required: true, message: '请填写籍贯!' }] }]" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="12" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="通讯地址">
                      <a-cascader :options="options_address" :load-data="loadDataAddress" :placeholder="actionType != 'view' ? '请选择地址...' : ''" change-on-select v-decorator="['AddressValue', { rules: [{ required: required, message: '请填写通讯地址!' }] }]" />
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="12" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="病历">
                      <div class="clearfix" v-if="actionType == 'edit' || actionType == 'add'">
                        <a-upload :action="a" :headers="headers" listType="picture-card" :fileList="CardUrlList" @preview="handlePreview" :beforeUpload="beforeCardUpload" @change="handleCardChange">
                          <a-icon :type="Cardloading ? 'loading' : 'plus'" />
                          <div class="ant-upload-text">上传</div>
                        </a-upload>
                      </div>
                      <div class="clearfix" v-if="fileCard.length > 0">
                        <img v-for="(item, index) in fileCard" :key="index" :src="item" style="width: 140px; height: 140px;margin-left:4px;padding:10px" />
                      </div>
                      <!-- <a-button v-if="actionType == 'edit' || actionType == 'add'" type="primary" @click="openScan('Students', 'Card')">高拍仪</a-button> -->
                    </a-form-item>
                  </a-col>
                  <a-col :md="12" :sm="24">
                    <a-row>
                      <a-col :md="24" :sm="24">
                        <a-form-item v-bind="formItemLayout2" label="详细地址">
                          <a-input v-decorator="['address']" />
                        </a-form-item>
                      </a-col>
                    </a-row>
                    <a-row>
                      <a-form-item v-bind="formItemLayout2" label="备注">
                        <a-textarea :rows="4" v-decorator="['remark']" />
                      </a-form-item>
                    </a-row>
                  </a-col>
                </a-row>
              </a-card>
            </a-tab-pane>
            <a-tab-pane forceRender :key="2" tab="入学项">
              <a-card :bordered="false" size="small">
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="入学时间">
                      <a-date-picker v-decorator="['entranceDate', { rules: [{ required: required, message: '请填写入学时间!' }] }]" style="width: 100%;" :placeholder="actionType == 'view' ? '' : '请选择日期...'" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="上课类型">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['ClassType']">
                        <a-select-option v-for="(item, index) in SKDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="陪护类型">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['EscortType']">
                        <a-select-option v-for="(item, index) in PHDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                </a-row>
              </a-card>
            </a-tab-pane>
            <a-tab-pane forceRender :key="3" tab="家庭情况">
              <a-card :bordered="false" size="small">
                <!-- <div slot="title" class="card_title">家庭情况 :</div> -->
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="家庭类型">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['familyType', { rules: [{ required: required, message: '请填写家庭类型!' }] }]">
                        <a-select-option v-for="(item, index) in JTLXDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="主要带养人">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['mainGuardian', { rules: [{ required: required, message: '请填写主要带养人!' }] }]">
                        <a-select-option v-for="(item, index) in ZYDYRDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                </a-row>
              </a-card>
            </a-tab-pane>
            <a-tab-pane forceRender :key="4" tab="能力信息" class="ability">
              <div style="overflow-x:auto">
                <a-card :bordered="false" size="small">
                  <!-- <div slot="title" class="card_title">能力信息 :</div> -->
                  <a-row class="checkbox bottom_dash" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                    <p class="title_top">社交能力</p>
                    <a-checkbox-group :options="plainOptions" v-model="checkedList" @change="onChange" />
                    <span class="title_top">备注</span>
                    <!-- <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll"> <a>选择所有</a> </a-checkbox> -->
                    <a-input class="remark_input" size="small" v-model="socialValue" />
                    <!-- <a-col :md="4" :sm="24">
                          <p class="title_top">备注</p>
                          <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_value" :key="index" v-model="plainOptions_value[index]" size="small" />
                        </a-col> -->
                  </a-row>
                  <a-row class="checkbox bottom_dash" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                    <p class="title_top">语言能力</p>
                    <a-checkbox-group :options="plainOptions_lang" v-model="checkedList_lang" @change="onChange_lang" />
                    <span class="title_top">备注</span>
                    <!-- <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_lang" @change="onCheckAllChange_lang" :checked="checkAll_lang"> <a>选择所有</a> </a-checkbox> -->
                    <a-input class="remark_input" size="small" v-model="langValue" />
                    <!-- <a-col :md="4" :sm="24">
                          <p class="title_top">备注</p>
                          <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_lang_value" :key="index" v-model="plainOptions_lang_value[index]" size="small" />
                        </a-col> -->
                  </a-row>
                  <a-row :gutter="12" class="checkbox checkbox2" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                    <a-col :md="4" :sm="24">
                      <p class="title_top">感知觉能力</p>
                      <a-checkbox-group :options="plainOptions_precept" v-model="checkedList_precept" @change="onChange_precept" />
                      <br />
                      <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_precept" @change="onCheckAllChange_precept" :checked="checkAll_precept"> <a>选择所有</a> </a-checkbox>
                    </a-col>
                    <a-col :md="4" :sm="24" class="right_dash">
                      <p class="title_top ">备注</p>
                      <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_precept_value" v-model="plainOptions_precept_value[index]" :key="index" size="small" />
                    </a-col>
                    <a-col :md="4" :sm="24">
                      <p class="title_top">自理能力</p>
                      <a-checkbox-group :options="plainOptions_selfcare" v-model="checkedList_selfcare" @change="onChange_selfcare" />
                      <br />
                      <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_selfcare" @change="onCheckAllChange_selfcare" :checked="checkAll_selfcare"> <a>选择所有</a> </a-checkbox>
                    </a-col>
                    <a-col :md="4" :sm="24" class="right_dash">
                      <p class="title_top ">备注</p>
                      <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_selfcare_value" v-model="plainOptions_selfcare_value[index]" :key="index" size="small" />
                    </a-col>
                    <a-col :md="4" :sm="24">
                      <p class="title_top">模仿能力</p>
                      <a-checkbox-group :options="plainOptions_imitation" v-model="checkedList_imitation" @change="onChange_imitation" />
                      <br />
                      <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_imitation" @change="onCheckAllChange_imitation" :checked="checkAll_imitation"> <a>选择所有</a> </a-checkbox>
                    </a-col>
                    <a-col :md="4" :sm="24">
                      <p class="title_top">备注</p>
                      <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_imitation_value" v-model="plainOptions_imitation_value[index]" :key="index" size="small" />
                    </a-col>
                  </a-row>
                  <a-row :gutter="12" class="checkbox checkbox2" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                    <a-col :md="4" :sm="24">
                      <p class="title_top">粗大运动</p>
                      <a-checkbox-group :options="plainOptions_grossmotor" v-model="checkedList_grossmotor" @change="onChange_grossmotor" />
                      <br />
                      <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_grossmotor" @change="onCheckAllChange_grossmotor" :checked="checkAll_grossmotor"> <a>选择所有</a> </a-checkbox>
                    </a-col>
                    <a-col :md="4" :sm="24" class="right_dash">
                      <p class="title_top">备注</p>
                      <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_grossmotor_value" v-model="plainOptions_grossmotor_value[index]" :key="index" size="small" />
                    </a-col>
                    <a-col :md="4" :sm="24">
                      <p class="title_top">精细运动</p>
                      <a-checkbox-group :options="plainOptions_finemotor" v-model="checkedList_finemotor" @change="onChange_finemotor" />
                      <br />
                      <a-checkbox v-if="actionType != 'view'" :indeterminate="indeterminate_finemotor" @change="onCheckAllChange_finemotor" :checked="checkAll_finemotor"> <a>选择所有</a> </a-checkbox>
                    </a-col>
                    <a-col :md="4" :sm="24">
                      <p class="title_top">备注</p>
                      <a-input style="margin-bottom:2px" v-for="(item, index) in plainOptions_finemotor_value" v-model="plainOptions_finemotor_value[index]" :key="index" size="small" />
                    </a-col>
                  </a-row>
                </a-card>
              </div>
            </a-tab-pane>
            <a-tab-pane forceRender :key="5" tab="健康信息">
              <a-card :bordered="false" size="small">
                <!-- <div slot="title" class="card_title">健康信息 :</div> -->
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="家族遗传病史">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['familyHistory', { rules: [{ required: required, message: '请填写家族遗传病史!' }] }]">
                        <a-select-option v-for="(item, index) in JZYCBSDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['familyHistoryTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="是否癫痫">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['isEpilepsy', { rules: [{ required: required, message: '请填写是否癫痫!' }] }]">
                        <a-select-option v-for="(item, index) in SFDXDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['isEpilepsyTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="睡眠情况">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['sleepCondition']">
                        <a-select-option v-for="(item, index) in SMQKDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['sleepConditionTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="饮食情况">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['diet']">
                        <a-select-option v-for="(item, index) in YSQKDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['dietTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="早期发育阶段">
                      <a-input v-decorator="['earlyDevelopmentStage']" />
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="5" :sm="24">
                    <a-form-item v-bind="formItemLayout4" label="是否有用药史">
                      <a-switch v-decorator="['isMedicationHistory', { valuePropName: 'checked' }]" checkedChildren="是" unCheckedChildren="否" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="用药史">
                      <a-input v-decorator="['medicationHistory']" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <span style="line-height:40px">
                      <a-icon type="info-circle" style="color: red" />
                      <a> 填写规范：时间(年月);药物名称;服用时长</a>
                    </span>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="5" :sm="24">
                    <a-form-item v-bind="formItemLayout4" label="是否有重大疾病史">
                      <a-switch @change="changeIsMajorDiseasesHistory" v-decorator="['isMajorDiseasesHistory', { valuePropName: 'checked' }]" checkedChildren="是" unCheckedChildren="否" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="重大疾病史">
                      <a-input v-decorator="['majorDiseasesHistory', { rules: [{ required: majorDiseasesHistoryRequired, message: '请填写重大疾病史!' }] }]" />
                    </a-form-item>
                  </a-col>
                </a-row>
              </a-card>
            </a-tab-pane>
            <a-tab-pane forceRender :key="6" tab="孕期信息">
              <a-card :bordered="false" size="small">
                <!-- <div slot="title" class="card_title">孕期信息 :</div> -->
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="是否足月">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['isFullTerm', { initialValue: 2414, rules: [{ required: required, message: '请填写足月!' }] }]">
                        <a-select-option v-for="(item, index) in ZuyueDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['isFullTermTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="胎次">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['parity', { initialValue: 2415, rules: [{ required: required, message: '请填写胎次!' }] }]">
                        <a-select-option v-for="(item, index) in TaiciDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['parityTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="哺乳方式">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['birthIndex', { initialValue: 2418 }]">
                        <a-select-option v-for="(item, index) in BuruDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['birthIndexTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="分娩方式">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['childbirthMode', { initialValue: 2421, rules: [{ required: required, message: '请填写分娩方式!' }] }]">
                        <a-select-option v-for="(item, index) in FenmianDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['childbirthModeTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <!-- <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="是否顺产">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['isNaturalBirth']">
                        <a-select-option v-for="(item, index) in ShunchanDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['isNaturalBirthTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row> -->
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="是否黄疸">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['isJaundice']">
                        <a-select-option v-for="(item, index) in HuangdouDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['isJaundiceTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="住院事项">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['hospitalizationMatters']">
                        <a-select-option v-for="(item, index) in ZhuyuanDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['hospitalizationMattersTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="6" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="是否双胞胎">
                      <a-select style="width:100%" allowClear showSearch optionFilterProp="children" :filterOption="filterOption" v-decorator="['isTwins', { initialValue: 2430 }]">
                        <a-select-option v-for="(item, index) in ShuangbaotaiDrop" :key="item.ID" :value="item.ID">
                          {{ item.Title }}
                        </a-select-option>
                      </a-select>
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout2" label="备注">
                      <a-input v-decorator="['isTwinsTxt']"></a-input>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                  <a-col :md="5" :sm="24">
                    <a-form-item v-bind="formItemLayout4" label="是否孕期服药">
                      <a-switch @change="changeIsMediHistoryDurPreg" v-decorator="['isMediHistoryDurPreg', { valuePropName: 'checked' }]" checkedChildren="是" unCheckedChildren="否" />
                    </a-form-item>
                  </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item v-bind="formItemLayout" label="孕期服药史">
                      <a-input v-decorator="['mediHistoryDurPreg', { rules: [{ required: mediHistoryDurPregRequired, message: '请填写孕期服药史!' }] }]" />
                    </a-form-item>
                  </a-col>
                </a-row>
              </a-card>
            </a-tab-pane>
            <a-tab-pane forceRender :key="7" tab="申报信息">
              <a-row :gutter="24" :class="[actionType == 'view' ? 'viewless notclickn' : '']">
                <a-col :md="6" :sm="24">
                  <a-form-item v-bind="formItemLayout" label="是否申报">
                    <a-switch v-decorator="['isDeclare', { valuePropName: 'checked' }]" checkedChildren="是" unCheckedChildren="否" />
                  </a-form-item>
                </a-col>
              </a-row>
              <action-form @handleAdd="handleAdd" @handleDel="handleDel"></action-form>
              <a-table size="small" bordered :rowKey="record => record.oid" :columns="columns" :dataSource="DeclareSubsidyExs" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :rowClassName="setRowClassName">
                <span slot="action" slot-scope="text, record">
                  <template>
                    <a type="link" @click="handleEdit(record)">修改</a>
                    <a-divider type="vertical" />
                    <a size="small" type="link" @click="handleView(record)">查看</a>
                  </template>
                </span>
              </a-table>
            </a-tab-pane>
          </a-tabs>
        </a-form>
      </div>
    </a-spin>
    <!-- </a-tab-pane>
      <a-tab-pane tab="监护人信息" key="2" forceRender> </a-tab-pane>
      <a-tab-pane tab="训练" key="3" forceRender> </a-tab-pane>
      <a-tab-pane tab="诊断" key="4" forceRender> </a-tab-pane>
      <a-tab-pane tab="评估" key="5" forceRender> </a-tab-pane>
      <a-tab-pane tab="入学" key="6" forceRender> </a-tab-pane>
      <a-tab-pane tab="转衔" key="7" forceRender> </a-tab-pane>
      <a-tab-pane tab="跟踪" key="8" forceRender> </a-tab-pane>
    </a-tabs> -->
    <info-modal :type="'simple'" :actionType="action" ref="infomodal" @save="handleSave"></info-modal>
    <photo-modal ref="photomodal"></photo-modal>
  </a-modal>
</template>

<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { uploadImage, getImg, studentInfo } from '@/api/students'
import { getDictByCode } from '@/api/dict'
import { areaList } from '@/api/area'
import { dropList } from '@/api/drop'
import dropValue from '@/views/dropValue'
import PhotoModal from '@/views/photoModal'
import { mapActions, mapGetters } from 'vuex'
import { phoneCheck, idCardCheck } from '@/views/validator'
import moment from 'moment'
import { idCard, tranDate } from '@/utils/util'
import SearchForm from './searchform'
import ActionForm from './actionform'
import InfoModal from '@/views/EntranceAndTransferAndTrack/modules/infomodal_declaresubsidy'
const checkData = [
  {
    key: 'socialSkills',
    value: '社交能力'
  },
  {
    key: 'languageAbility',
    value: '语言能力'
  },
  {
    key: 'perceptualAbility',
    value: '感知觉能力'
  },
  {
    key: 'selfCareAbility',
    value: '自理能力'
  },
  {
    key: 'imitationAbility',
    value: '模仿能力'
  },
  {
    key: 'grossMotor',
    value: '粗大运动'
  },
  {
    key: 'fineMotor',
    value: '精细运动'
  }
]
const indexData = [
  {
    // data: ['Code', 'ConsultationTime', 'name', 'IDNumber', 'sex', 'birthday', 'height', 'weight', 'nation', 'bloodType', 'NativePlaceValue', 'AddressValue', 'address', 'remark', 'ConsultationSrc', 'NonEnrollmen']
    data: ['Code', 'ConsultationTime', 'name', 'IDNumber', 'sex', 'birthday', 'nation', 'NativePlaceValue', 'AddressValue', 'address', 'remark', 'ConsultationSrc', 'NonEnrollmen']
  },
  {
    data: ['entranceDate', 'ClassType', 'EscortType']
  },
  {
    data: ['familyType', 'mainGuardian']
  },
  {
    data: []
  },
  {
    data: ['familyHistory', 'familyHistoryTxt', 'isEpilepsy', 'isEpilepsyTxt', 'sleepCondition', 'sleepConditionTxt', 'diet', 'dietTxt', 'earlyDevelopmentStage', 'isMedicationHistory', 'medicationHistory', 'isMajorDiseasesHistory', 'majorDiseasesHistory']
  },
  {
    data: ['isFullTerm', 'isFullTermTxt', 'parity', 'parityTxt', 'birthIndex', 'birthday', 'birthIndexTxt', 'childbirthMode', 'childbirthModeTxt', 'isJaundice', 'isJaundiceTxt', 'hospitalizationMatters', 'hospitalizationMattersTxt', 'isTwins', 'isTwinsTxt', 'isMediHistoryDurPreg', 'mediHistoryDurPreg']
  },
  {
    data: ['isDeclare']
  }
]
export default {
  components: { PhotoModal, InfoModal, SearchForm, ActionForm },
  props: {
    actionType: {
      type: String,
      required: false,
      default: 'add'
    }
  },
  data () {
    return {
      a: null,
      action: 'add',
      checkData,
      indexData,
      headers: {},
      currentId: null,
      CodeDisabled: false,
      required: false,
      indicator: <a-icon type="loading" style="font-size: 24px" spin />,
      form: this.$form.createForm(this),
      button_loading: false,
      spinning: false,
      tip: null,
      title: '添加学生',
      visible: false,
      Photoloading: false,
      PhotoUrl: '',
      PhotoUrlDb: {},
      PhotoUrlDbString: '',

      Cardloading: false,
      CardUrl: [],
      CardUrlList: [],
      CardUrlDb: [],

      upPhotoloading: false,
      upCardloading: false,
      upRightloading: false,

      filePhoto: null,
      fileCard: [],
      fileRight: [],
      fileOther: [],

      filePhotoList: [],
      fileCardList: [],
      fileRightList: [],
      uploadParams: {
        tablename: 'StudentInfo',
        signname: null
      },
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 8 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        }
      },
      formItemLayout4: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 17 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 7 }
        }
      },
      formItemLayout3: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 2 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 22 }
        }
      },
      formItemLayout2: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 4 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 20 }
        }
      },
      formItemLayout1: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 3 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 21 }
        }
      },
      idCard: {
        workerName: null,
        sex: null,
        idCardNumber: null,
        csrq: null,
        sfzyxqrq: null,
        sfzyxzrq: null,
        nation: null,
        sfzImage: null
      },
      okText: '保存',
      cancelText: '取消',
      base64Data: null,
      isRetire: false,
      MZDrop: [],
      WRXDrop: [],
      JTLXDrop: [],
      ZYDYRDrop: [],
      JZYCBSDrop: [],
      SFDXDrop: [],
      SMQKDrop: [],
      YSQKDrop: [],
      SKDrop: [],
      PHDrop: [],
      ZXDrop: [],
      AbilityDrop: [],
      socialSkillsDrop: [],
      languageAbilityDrop: [],
      perceptualAbilityDrop: [],
      selfCareAbilityDrop: [],
      imitationAbilityDrop: [],
      grossMotorDrop: [],
      fineMotorDrop: [],

      indeterminate: false,
      checkAll: false,
      source: [],
      plainOptions: [],
      checkedList: [],
      plainOptions_value: [],
      socialValue: null,

      indeterminate_lang: false,
      checkAll_lang: false,
      source_lang: [],
      plainOptions_lang: [],
      checkedList_lang: [],
      plainOptions_lang_value: [],
      langValue: null,

      indeterminate_precept: false,
      checkAll_precept: false,
      source_precept: [],
      plainOptions_precept: [],
      checkedList_precept: [],
      plainOptions_precept_value: [],

      indeterminate_selfcare: false,
      checkAll_selfcare: false,
      source_selfcare: [],
      plainOptions_selfcare: [],
      checkedList_selfcare: [],
      plainOptions_selfcare_value: [],

      indeterminate_imitation: false,
      checkAll_imitation: false,
      source_imitation: [],
      plainOptions_imitation: [],
      checkedList_imitation: [],
      plainOptions_imitation_value: [],

      indeterminate_grossmotor: false,
      checkAll_grossmotor: false,
      source_grossmotor: [],
      plainOptions_grossmotor: [],
      checkedList_grossmotor: [],
      plainOptions_grossmotor_value: [],

      indeterminate_finemotor: false,
      checkAll_finemotor: false,
      source_finemotor: [],
      plainOptions_finemotor: [],
      checkedList_finemotor: [],
      plainOptions_finemotor_value: [],

      options_nativePlace: [],
      options_address: [],
      ZuyueDrop: [],
      TaiciDrop: [],
      BuruDrop: [],
      FenmianDrop: [],
      HuangdouDrop: [],
      ZhuyuanDrop: [],
      ShuangbaotaiDrop: [],
      ShunchanDrop: [],

      NativePlaceValue: [],
      AddressValue: [],
      StudentDict: [],
      NativePlace: [],
      Address: [],
      DeclareSubsidys: [],
      selectedRowKeys: [],
      declaresubsidy_data: [],
      columns: [
        {
          title: '申报补助时间',
          dataIndex: 'declareDate',
          key: 'declareDate',
          align: 'center'
        },
        {
          title: '申报补助片区',
          dataIndex: 'DeclareArea',
          key: 'DeclareArea',
          align: 'center'
        }
      ],
      StudentInfo: {},
      mediHistoryDurPregRequired: false,
      majorDiseasesHistoryRequired: false,
      activeKey: 1,
      DeclareSubsidyExs: []
    }
  },
  watch: {},
  computed: { ...mapGetters(['token']) },
  methods: {
    phoneCheck,
    idCardCheck,
    moment,
    openScan (a, b) {
      this.$refs.scan.show(a, b)
    },
    saveFile (res, resurl, c) {
      if (c.signname == 'Card') {
        const a = {
          uid: res.NewFileName,
          name: String(res.ID),
          status: 'done',
          url: getImg(`${res.Path}${res.NewFileName}`),
          scan: true,
          response: res
        }
        this.CardUrlList.push(a)
        // this.CardUrlDb = a
        // this.CardUrl = b
      }
    },
    buttonText (actionType) {
      if (actionType == 'view') {
        this.okText = '关闭'
        this.cancelText = null
      } else {
        this.okText = '保存'
        this.cancelText = '关闭'
      }
    },
    clearData () {
      Object.assign(this, {
        PhotoUrl: null,
        PhotoUrlDb: null,
        PhotoUrlDbString: null,
        CardUrl: [],
        CardUrlList: [],
        CardUrlDb: [],
        filePhoto: null,
        fileCard: [],
        fileRight: [],
        fileOther: [],
        tip: '数据获取中...',
        isRetire: false,
        AddressValue: [],
        NativePlaceValue: [],
        DeclareSubsidys: [],

        indeterminate: false,
        checkAll: false,

        checkedList: [],
        plainOptions_value: [],
        socialValue: null,

        indeterminate_lang: false,
        checkAll_lang: false,

        checkedList_lang: [],
        plainOptions_lang_value: [],
        langValue: null,

        indeterminate_precept: false,
        checkAll_precept: false,

        checkedList_precept: [],
        plainOptions_precept_value: [],

        indeterminate_selfcare: false,
        checkAll_selfcare: false,

        checkedList_selfcare: [],
        plainOptions_selfcare_value: [],

        indeterminate_imitation: false,
        checkAll_imitation: false,

        checkedList_imitation: [],
        plainOptions_imitation_value: [],

        indeterminate_grossmotor: false,
        checkAll_grossmotor: false,

        checkedList_grossmotor: [],
        plainOptions_grossmotor_value: [],

        indeterminate_finemotor: false,
        checkAll_finemotor: false,

        checkedList_finemotor: [],
        plainOptions_finemotor_value: [],

        majorDiseasesHistoryRequired: false,
        mediHistoryDurPregRequired: false,
        options_address: [],
        options_nativePlace: [],
        StudentInfo: {}
      })
    },
    reset () {
      this.idCard = {
        workerName: null,
        sex: null,
        idCardNumber: null,
        csrq: null,
        sfzyxqrq: null,
        sfzyxzrq: null,
        nation: null,
        sfzImage: null
      }
    },
    dataURLtoFile (dataurl, filename) {
      var arr = dataurl.split(','),
        mime = arr[0].match(/:(.*?);/)[1],
        bstr = atob(arr[1]),
        n = bstr.length,
        u8arr = new Uint8Array(n)
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n)
      }
      // return new File([u8arr], filename, { type: mime }, { uid: `vc-upload-${moment().format('YYYYMMDDHHmmss')}` })

      return new Blob([u8arr], { type: mime })
    },
    add () {
      Object.assign(this, {
        visible: true,
        CodeDisabled: true,
        title: '添加学生',
        currentId: null
      })
      this.initAreaList()
      this.clearData()
      console.log(this.currentId)
      this.form.resetFields()
      setTimeout(() => {
        this.buttonText(this.actionType)
      }, 500)
    },
    edit (data) {
      Object.assign(this, {
        spinning: true,
        visible: true,
        CodeDisabled: false,
        currentId: data.StudentInfo.id,
        title: '修改学生'
      })
      this.initAreaList()
      this.clearData()
      this.form.resetFields()
      this.initData(data)
      this.buttonText(this.actionType)
    },
    view (data) {
      Object.assign(this, {
        spinning: true,
        visible: true,
        CodeDisabled: false,
        currentId: data.StudentInfo.id,
        title: '查看学生'
      })
      this.initAreaList()
      this.clearData()
      this.form.resetFields()
      this.initData(data)
      this.buttonText(this.actionType)
    },
    idCardChange (e) {
      var id = e.target.value
      var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
      // if(id.length==15){
      //    reg = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
      // }
      // else if(id.length==18){
      //    reg = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
      // }
      if (reg.test(id) === false) {
        return false
      } else {
        this.form.setFieldsValue({ sex: parseInt(idCard(id, 2)) })
        this.form.setFieldsValue({ birthday: moment(idCard(id, 1), 'YYYY-MM-DD') })
        // this.form.setFieldsValue({ Age: String(idCard(id, 3)) })
        if (id.length > 17) {
          var provinceCode = parseFloat(id.substring(0, 2))
          var cityCode = parseFloat(id.substring(0, 4) + '00000000')
          var countyCode = parseFloat(id.substring(0, 6) + '000000')

          var start = new Promise((resolve, reject) => {
            const targetOption = this.options_nativePlace.filter(a => a.value == provinceCode)[0]
            if (targetOption) {
              targetOption.loading = true
              areaList({ parentID: targetOption.value }).then(res => {
                console.log('2')
                var _options = []
                res.data.map(a => {
                  _options.push({
                    value: a.id,
                    label: a.areaName,
                    isLeaf: a.depth < 2 ? false : true
                  })
                })
                targetOption.children = _options
                targetOption.loading = false
                // this.options_nativePlace = [...this.options_nativePlace]
              })
            }
            resolve(this.options_nativePlace)
          })

          start.then(options_nativePlace => {
            return new Promise((resolve, reject) => {
              setTimeout(() => {
                const b = this.options_nativePlace.filter(a => a.value == provinceCode)[0]
                if (b) {
                  const value = b.hasOwnProperty('children') ? b.children.filter(a => a.value == cityCode)[0] : null
                  var params
                  const targetOption = value
                  if (targetOption) {
                    targetOption.loading = true
                    params = value.value
                    areaList({ parentID: params }).then(res => {
                      console.log('3')
                      var _options = []
                      res.data.map(a => {
                        _options.push({
                          value: a.id,
                          label: a.areaName,
                          isLeaf: a.depth < 2 ? false : true
                        })
                      })
                      targetOption.children = _options
                      targetOption.loading = false
                      // this.options_nativePlace = options_nativePlace
                      console.log(this.options_nativePlace)
                      setTimeout(() => {
                        this.form.setFieldsValue({ NativePlaceValue: [provinceCode, cityCode, countyCode] })
                      }, 200)
                    })
                  }
                }
                resolve()
              }, 200)
            })
          })
        } else {
          this.form.setFieldsValue({ NativePlaceValue: [] })
        }
      }
    },
    initData (data) {
      setTimeout(() => {
        const StudentInfo = data.StudentInfo
        this.StudentInfo = data.StudentInfo
        data.DeclareSubsidyExs.map((a, index) => {
          a.oid = `${moment().format('YYYYMMDDHHmmss')}de${index}`
          a.declareDate = tranDate(a.declareDate)
        })
        this.DeclareSubsidys = data.DeclareSubsidys
        this.DeclareSubsidyExs = data.DeclareSubsidyExs
        const card = data.Uploads.filter(a => a.signName == 'medicalRecord')
        card.forEach(item => {
          const a = {
            uid: String(item.ID),
            name: String(item.ID),
            status: 'done',
            url: getImg(`${item.Path}/${item.NewFileName}`)
          }
          this.CardUrlList.push(a)
        })
        if (this.actionType === 'edit') {
          Object.assign(this, {
            // PhotoUrlDb: photo,
            CardUrlDb: card,
            PhotoUrlDbString: StudentInfo.photoUrl,
            PhotoUrl: StudentInfo.photoUrl != null ? getImg(StudentInfo.photoUrl) : null
          })
        } else {
          Object.assign(this, {
            filePhoto: StudentInfo.photoUrl != null ? getImg(StudentInfo.photoUrl) : null,
            fileCard: this.CardUrlList.map(a => {
              return a.url
            })
          })
        }
        const StudentDict = data.StudentDict
        //#region  多选回填
        this.checkedList = this.source
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_value = []
        this.source.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
            this.socialValue = StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description
          } else {
            plainOptions_value.push(null)
          }
          this.plainOptions_value = plainOptions_value
        })
        this.checkedList_lang = this.source_lang
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_lang_value = []
        this.source_lang.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_lang_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
            this.langValue = StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description
          } else {
            plainOptions_lang_value.push(null)
          }
          this.plainOptions_lang_value = plainOptions_lang_value
        })
        this.checkedList_precept = this.source_precept
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_precept_value = []
        this.source_precept.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_precept_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
          } else {
            plainOptions_precept_value.push(null)
          }
          this.plainOptions_precept_value = plainOptions_precept_value
        })
        this.checkedList_selfcare = this.source_selfcare
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_selfcare_value = []
        this.source_selfcare.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_selfcare_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
          } else {
            plainOptions_selfcare_value.push(null)
          }
          this.plainOptions_selfcare_value = plainOptions_selfcare_value
        })
        this.checkedList_imitation = this.source_imitation
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_imitation_value = []
        this.source_imitation.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_imitation_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
          } else {
            plainOptions_imitation_value.push(null)
          }
          this.plainOptions_imitation_value = plainOptions_imitation_value
        })
        this.checkedList_grossmotor = this.source_grossmotor
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_grossmotor_value = []
        this.source_grossmotor.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_grossmotor_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
          } else {
            plainOptions_grossmotor_value.push(null)
          }
          this.plainOptions_grossmotor_value = plainOptions_grossmotor_value
        })
        this.checkedList_finemotor = this.source_finemotor
          .filter(a => {
            return StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)
          })
          .map(c => {
            return c.Title
          })
        var plainOptions_finemotor_value = []
        this.source_finemotor.forEach(a => {
          if (StudentDict.some(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID)) {
            plainOptions_finemotor_value.push(StudentDict.find(b => b.abilityDictID == a.DictCategoryId && b.selectDictID == a.ID).description)
          } else {
            plainOptions_finemotor_value.push(null)
          }
          this.plainOptions_finemotor_value = plainOptions_finemotor_value
        })
        //#endregion
        const { setFieldsValue } = this.form
        //#region 省市区回填
        var start = new Promise(resolve => {
          areaList({ parentID: 0 }).then(res => {
            console.log('1')
            var _options = []
            res.data.map(a => {
              _options.push({
                value: a.id,
                label: a.areaName,
                isLeaf: false
              })
            })
            this.options_address = _options
            this.options_nativePlace = _options
          })
          resolve()
        })
        start
          .then(() => {
            // setTimeout(() => {
            //   this.loadDataNativePlace(this.options_nativePlace.filter(a => a.value == StudentInfo.NativePlace_province))
            //   setFieldsValue({ NativePlaceValue: [StudentInfo.NativePlace_province, StudentInfo.NativePlace_city] })
            //   // this.NativePlaceValue = [StudentInfo.NativePlace_province, StudentInfo.NativePlace_city]
            // }, 500)

            return new Promise((resolve, reject) => {
              setTimeout(() => {
                const targetOption = this.options_nativePlace.filter(a => a.value == StudentInfo.NativePlace_province)[0]
                if (targetOption) {
                  targetOption.loading = true
                  areaList({ parentID: targetOption.value }).then(res => {
                    console.log('2')
                    var _options = []
                    res.data.map(a => {
                      _options.push({
                        value: a.id,
                        label: a.areaName,
                        isLeaf: a.depth < 2 ? false : true
                      })
                    })
                    targetOption.children = _options
                    targetOption.loading = false
                    // this.options_nativePlace = [...this.options_nativePlace]
                  })
                }
                resolve(this.options_nativePlace)
                console.log(this.options_nativePlace)
              }, 200)
            })
          })
          .then(options_nativePlace => {
            return new Promise((resolve, reject) => {
              setTimeout(() => {
                const b = options_nativePlace.filter(a => a.value == StudentInfo.NativePlace_province)[0]
                if (b) {
                  const value = b.hasOwnProperty('children') ? b.children.filter(a => a.value == StudentInfo.NativePlace_city)[0] : null
                  var params
                  const targetOption = value
                  if (targetOption) {
                    targetOption.loading = true
                    params = value.value
                    areaList({ parentID: params }).then(res => {
                      console.log('3')
                      var _options = []
                      res.data.map(a => {
                        _options.push({
                          value: a.id,
                          label: a.areaName,
                          isLeaf: a.depth < 2 ? false : true
                        })
                      })
                      targetOption.children = _options
                      targetOption.loading = false
                      this.options_nativePlace = [...options_nativePlace]
                      setFieldsValue({ NativePlaceValue: [StudentInfo.NativePlace_province, StudentInfo.NativePlace_city, StudentInfo.NativePlace_county] })
                    })
                  }
                }
                // setFieldsValue({ NativePlaceValue: [StudentInfo.NativePlace_province, StudentInfo.NativePlace_city, StudentInfo.NativePlace_county] })
                resolve()
              }, 200)
            })
          })
          .then(() => {
            return new Promise((resolve, reject) => {
              setTimeout(() => {
                const targetOption = this.options_address.filter(a => a.value == StudentInfo.province)[0]
                if (targetOption) {
                  targetOption.loading = true
                  areaList({ parentID: targetOption.value }).then(res => {
                    console.log('4')
                    var _options = []
                    res.data.map(a => {
                      _options.push({
                        value: a.id,
                        label: a.areaName,
                        isLeaf: a.depth < 2 ? false : true
                      })
                    })
                    targetOption.children = _options
                    targetOption.loading = false
                    // this.options_address = [...this.options_address]
                  })
                }
                resolve(this.options_address)
              }, 200)
            })
          })
          .then(options_address => {
            return new Promise((resolve, reject) => {
              setTimeout(() => {
                const b = options_address.filter(a => a.value == StudentInfo.province)[0]
                if (b) {
                  const value = b.hasOwnProperty('children') ? b.children.filter(a => a.value == StudentInfo.city)[0] : null
                  var params
                  const targetOption = value
                  if (targetOption) {
                    targetOption.loading = true
                    params = value.value
                    areaList({ parentID: params }).then(res => {
                      console.log('5')
                      var _options = []
                      res.data.map(a => {
                        _options.push({
                          value: a.id,
                          label: a.areaName,
                          isLeaf: a.depth < 2 ? false : true
                        })
                      })
                      targetOption.children = _options
                      targetOption.loading = false
                      this.options_address = [...options_address]
                      console.log(this.options_address)
                      setFieldsValue({ AddressValue: [StudentInfo.province, StudentInfo.city, StudentInfo.county] })
                    })
                  }
                }
                // setFieldsValue({ AddressValue: [StudentInfo.province, StudentInfo.city, StudentInfo.county] })
                this.spinning = false
                resolve()
              }, 200)
            })
          })
        //#endregion

        if (StudentInfo.birthday != null) {
          setFieldsValue({ birthday: moment(StudentInfo.birthday, 'YYYY-MM-DD') })
        }
        if (StudentInfo.ConsultationTime != null) {
          setFieldsValue({ ConsultationTime: moment(StudentInfo.ConsultationTime, 'YYYY-MM-DD') })
        }
        setFieldsValue({ Code: StudentInfo.Code })
        setFieldsValue({ name: StudentInfo.name })
        setFieldsValue({ IDNumber: StudentInfo.IDNumber })
        setFieldsValue({ sex: StudentInfo.sex })
        setFieldsValue({ address: StudentInfo.address })
        setFieldsValue({ nation: StudentInfo.nation })
        // setFieldsValue({ height: StudentInfo.height })
        // setFieldsValue({ weight: StudentInfo.weight })
        // setFieldsValue({ bloodType: StudentInfo.bloodType })

        setFieldsValue({ remark: StudentInfo.remark })

        if (StudentInfo.entranceDate != null) {
          setFieldsValue({ entranceDate: moment(StudentInfo.entranceDate, 'YYYY-MM-DD') })
        }
        setFieldsValue({ ConsultationSrc: StudentInfo.ConsultationSrc })
        setFieldsValue({ NonEnrollmen: StudentInfo.NonEnrollmen })
        setFieldsValue({ ClassType: StudentInfo.ClassType })
        setFieldsValue({ EscortType: StudentInfo.EscortType })

        setFieldsValue({ familyType: StudentInfo.familyType })
        setFieldsValue({ mainGuardian: StudentInfo.mainGuardian })
        setFieldsValue({ familyHistory: StudentInfo.familyHistory })

        setFieldsValue({ isEpilepsy: StudentInfo.isEpilepsy })
        setFieldsValue({ sleepCondition: StudentInfo.sleepCondition })
        setFieldsValue({ diet: StudentInfo.diet })
        setFieldsValue({ isMedicationHistory: StudentInfo.isMedicationHistory })
        setFieldsValue({ medicationHistory: StudentInfo.medicationHistory })
        setFieldsValue({ earlyDevelopmentStage: StudentInfo.earlyDevelopmentStage })
        setFieldsValue({ isMajorDiseasesHistory: StudentInfo.isMajorDiseasesHistory })
        this.majorDiseasesHistoryRequired = studentInfo.isMajorDiseasesHistory
        setFieldsValue({ majorDiseasesHistory: StudentInfo.majorDiseasesHistory })
        setFieldsValue({ isFullTerm: StudentInfo.isFullTerm == null ? 2414 : StudentInfo.isFullTerm })
        setFieldsValue({ parity: StudentInfo.parity == null ? 2415 : StudentInfo.parity })
        setFieldsValue({ birthIndex: StudentInfo.birthIndex == null ? 2418 : StudentInfo.birthIndex })
        setFieldsValue({ childbirthMode: StudentInfo.childbirthMode == null ? 2421 : StudentInfo.childbirthMode })
        // setFieldsValue({ isNaturalBirth: StudentInfo.isNaturalBirth })
        setFieldsValue({ isJaundice: StudentInfo.isJaundice })

        setFieldsValue({ hospitalizationMatters: StudentInfo.hospitalizationMatters })
        setFieldsValue({ isTwins: StudentInfo.isTwins == null ? 2430 : StudentInfo.isTwins })
        setFieldsValue({ isMediHistoryDurPreg: StudentInfo.isMediHistoryDurPreg })
        this.mediHistoryDurPregRequired = StudentInfo.isMediHistoryDurPreg
        setFieldsValue({ mediHistoryDurPreg: StudentInfo.mediHistoryDurPreg })

        setFieldsValue({ familyHistoryTxt: StudentInfo.familyHistoryTxt })
        setFieldsValue({ isEpilepsyTxt: StudentInfo.isEpilepsyTxt })
        setFieldsValue({ sleepConditionTxt: StudentInfo.sleepConditionTxt })
        setFieldsValue({ dietTxt: StudentInfo.dietTxt })
        setFieldsValue({ isFullTermTxt: StudentInfo.isFullTermTxt })
        setFieldsValue({ parityTxt: StudentInfo.parityTxt })
        setFieldsValue({ birthIndexTxt: StudentInfo.birthIndexTxt })
        setFieldsValue({ childbirthModeTxt: StudentInfo.childbirthModeTxt })
        // setFieldsValue({ isNaturalBirthTxt: StudentInfo.isNaturalBirthTxt })
        setFieldsValue({ isJaundiceTxt: StudentInfo.isJaundiceTxt })
        setFieldsValue({ hospitalizationMattersTxt: StudentInfo.hospitalizationMattersTxt })
        setFieldsValue({ isTwinsTxt: StudentInfo.isTwinsTxt })
        setFieldsValue({ isDeclare: StudentInfo.isDeclare })
      }, 1000)
    },
    handleSubmit () {
      const {
        form: { validateFieldsAndScroll }
      } = this
      validateFieldsAndScroll((errors, values) => {
        if (!errors) {
          this.tranData(values)
        } else {
          var a = Object.values(errors)[0].errors[0].field
          var tabIndex = 0
          this.indexData.some((item, index) => {
            if (item.data.indexOf(a) >= 0) {
              tabIndex = index
              return true
            }
          })
          this.activeKey = tabIndex + 1
        }
      })
    },
    tranData (values) {
      this.button_loading = true
      setTimeout(() => {
        let Uploads = []
        let StudentDict = []
        var _this = this
        this.CardUrlList.map(aa => {
          if (aa.scan) {
            aa.response && Uploads.push(aa.response)
          }
          if (!aa.url && !aa.scan) {
            aa.response && Uploads.push(aa.response)
          }
          if (aa.url && !aa.scan) {
            Uploads.push(_this.CardUrlDb.find(a => a.ID == aa.uid))
          }
        })
        // this.PhotoUrlDb && Uploads.push(this.PhotoUrlDb)
        // this.CardUrlDb && Uploads.push(this.CardUrlDb)
        // this.RightUrlDb && upload.push(this.RightUrlDb)
        let StudentInfo = {
          ...this.StudentInfo,
          ...values,
          NativePlace_province: values['NativePlaceValue'].length > 0 ? values['NativePlaceValue'][0] : null,
          NativePlace_city: values['NativePlaceValue'].length > 1 ? values['NativePlaceValue'][1] : null,
          NativePlace_county: values['NativePlaceValue'].length > 2 ? values['NativePlaceValue'][2] : null,
          province: values['AddressValue'] != null ? (values['AddressValue'].length > 0 ? values['AddressValue'][0] : null) : null,
          city: values['AddressValue'] != null ? (values['AddressValue'].length > 1 ? values['AddressValue'][1] : null) : null,
          county: values['AddressValue'] != null ? (values['AddressValue'].length > 2 ? values['AddressValue'][2] : null) : null,
          ConsultationTime: values['ConsultationTime'] == null ? null : values['ConsultationTime'].format('YYYY-MM-DD'),
          entranceDate: values['entranceDate'] == null ? null : values['entranceDate'].format('YYYY-MM-DD'),
          birthday: values['birthday'] == null ? null : values['birthday'].format('YYYY-MM-DD'),
          addTime: this.actionType === 'edit' ? this.StudentInfo.addTime : moment().format('YYYY-MM-DD HH:mm:ss'),
          addUserID: this.actionType === 'edit' ? this.StudentInfo.addUserID : this.token.id,
          UpdateUserID: this.actionType === 'add' ? null : this.token.id,
          updateTime: this.actionType === 'add' ? null : moment().format('YYYY-MM-DD HH:mm:ss'),
          photoUrl: this.PhotoUrlDbString
        }
        this.source.forEach((a, index) => {
          if (this.checkedList.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.socialValue,
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_lang.forEach((a, index) => {
          if (this.checkedList_lang.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.langValue,
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_precept.forEach((a, index) => {
          if (this.checkedList_precept.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.plainOptions_precept_value[index],
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_selfcare.forEach((a, index) => {
          if (this.checkedList_selfcare.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.plainOptions_selfcare_value[index],
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_imitation.forEach((a, index) => {
          if (this.checkedList_imitation.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.plainOptions_imitation_value[index],
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_grossmotor.forEach((a, index) => {
          if (this.checkedList_grossmotor.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.plainOptions_grossmotor_value[index],
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })
        this.source_finemotor.forEach((a, index) => {
          if (this.checkedList_finemotor.indexOf(a.Title) > -1) {
            StudentDict.push({
              abilityDictID: a.DictCategoryId,
              selectDictID: a.ID,
              description: this.plainOptions_finemotor_value[index],
              AddUserID: this.actionType === 'edit' ? null : this.token.id,
              UpdateUserID: this.actionType === 'add' ? null : this.token.id
            })
          }
        })

        const value = {
          StudentInfo: StudentInfo,
          Uploads: Uploads,
          StudentDict: StudentDict,
          DeclareSubsidys: this.DeclareSubsidyExs.map(a => {
            return {
              declareDate: a.declareDate,
              declareArea: a.declareArea,
              declareArea_province: a.declareArea_province,
              declareArea_city: a.declareArea_city,
              declareArea_county: a.declareArea_county,
              subsidyType: a.subsidyType,
              addUserID: this.actionType === 'edit' ? this.StudentInfo.addUserID : this.token.id,
              editUserID: this.actionType === 'add' ? null : this.token.id,
              DeclareArea: a.DeclareArea
            }
          })
        }
        this.button_loading = false
        if (this.actionType == 'add') {
          this.currentId = null
        }
        console.log(this.currentId)
        this.$emit('save', value, this.currentId)
        // this.visible = false
      }, 1000)
    },
    handlePhotoChange (info) {
      if (info.file.status === 'error') {
        this.$message.error(`认证过期:${info.file.response}`)
      }
      if (info.file.status === 'uploading') {
        this.Photoloading = true
        return
      }
      if (info.file.status === 'done') {
        this.PhotoUrlDb = info.file.response
        this.PhotoUrl = getImg(`${this.PhotoUrlDb.Path}/${this.PhotoUrlDb.NewFileName}`)
        this.PhotoUrlDbString = `${this.PhotoUrlDb.Path}/${this.PhotoUrlDb.NewFileName}`
        this.Photoloading = false
      }
    },
    handleCardChange ({ file, fileList }) {
      if (file.status === 'uploading') {
        this.Cardloading = true
      }
      if (file.status === 'done') {
        // this.QianshouUrlDb = file.response
        // // let parama = []
        // // parama.push(Object.assign(this.QianshouUrlDb, { RecordID: this.currentId }))
        // // saveReceipt(parama).then((res) => {})
        // this.QianshouUrl = getImg(`${this.QianshouUrlDb.Path}${this.QianshouUrlDb.NewFileName}`)
        this.Cardloading = false
      }
      this.CardUrlList = fileList
    },
    handPhotoUpload (file) {
      this.Photoloading = true
      this.uploadParams.signname = 'Photo'
      const { uploadParams } = this
      // this.a = process.env.VUE_APP_API_BASE_URL + `/api/gudong/uploadImage?tablename=${uploadParams.tablename}&signname=${uploadParams.signname}`
      const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
      if (!isJpgOrPng) {
        this.$message.error('您只能上传JPG或PNG!')
      }
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isLt2M) {
        this.$message.error('必须小于2MB!')
      }
      if (isJpgOrPng && isLt2M) {
        const formData = new FormData()
        formData.append('file', file, 'touxiang.jpg')
        this.uploading = true
        uploadImage(formData, uploadParams).then(res => {
          if (res) {
            this.$message.success('上传成功!')
            this.PhotoUrlDb = res
            this.PhotoUrl = getImg(`${this.PhotoUrlDb.Path}/${this.PhotoUrlDb.NewFileName}`)
            this.PhotoUrlDbString = `${this.PhotoUrlDb.Path}/${this.PhotoUrlDb.NewFileName}`
            this.Photoloading = false
          } else {
            this.Photoloading = false
            this.$message.error('上传失败!')
          }
        })
      }
    },
    beforePhotoUpload (file) {
      this.uploadParams.signname = 'Photo'
      const { uploadParams } = this
      const token = Vue.ls.get(ACCESS_TOKEN) && Vue.ls.get(ACCESS_TOKEN).token
      this.headers = {
        authorization: 'Bearer ' + token
      }
      this.a = process.env.VUE_APP_API_BASE_URL + `/api/Upload/uploadImg?tablename=${uploadParams.tablename}&signname=${uploadParams.signname}`
      const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
      if (!isJpgOrPng) {
        this.$message.error('您只能上传JPG或PNG!')
      }
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isLt2M) {
        this.$message.error('必须小于2MB!')
      }
      return isJpgOrPng && isLt2M
    },
    beforeCardUpload (file) {
      this.uploadParams.signname = 'medicalRecord'
      const { uploadParams } = this
      const token = Vue.ls.get(ACCESS_TOKEN) && Vue.ls.get(ACCESS_TOKEN).token
      this.headers = {
        authorization: 'Bearer ' + token
      }
      this.a = process.env.VUE_APP_API_BASE_URL + `/api/Upload/uploadImg?tablename=${uploadParams.tablename}&signname=${uploadParams.signname}`
      const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
      if (!isJpgOrPng) {
        this.$message.error('您只能上传JPG或PNG!')
      }
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isLt2M) {
        this.$message.error('必须小于2MB!')
      }
      return isJpgOrPng && isLt2M
    },
    removePhotoUrl () {
      this.PhotoUrl = null
      this.PhotoUrlDb = null
      this.PhotoUrlDbString = null
    },
    removeCardUrl () {
      this.CardUrl = null
      this.CardUrlDb = null
    },
    removeRightUrl () {
      this.RightUrl = null
      this.RightUrlDb = null
    },
    async handlePreview (file) {
      if (!file.url && !file.preview) {
        var printUrl = getImg(`${file.response.Path}/${file.response.NewFileName}`)
        this.$refs.photomodal.view(printUrl)
      } else {
        var printUrl = file.url
        this.$refs.photomodal.view(printUrl)
      }
    },
    viewPhoto (data) {
      this.$refs.photomodal.view(data == 1 ? this.PhotoUrl : data == 2 ? this.CardUrl : data == 3 ? this.RightUrl : '')
    },
    filterOption (input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    onChange (checkedList) {
      this.indeterminate = !!checkedList.length && checkedList.length < this.plainOptions.length
      this.checkAll = checkedList.length === this.plainOptions.length
    },
    onCheckAllChange (e) {
      Object.assign(this, {
        checkedList: e.target.checked ? this.plainOptions : [],
        indeterminate: false,
        checkAll: e.target.checked
      })
    },
    onChange_lang (checkedList) {
      this.indeterminate_lang = !!checkedList.length && checkedList.length < this.plainOptions_lang.length
      this.checkAll_lang = checkedList.length === this.plainOptions_lang.length
    },
    onCheckAllChange_lang (e) {
      Object.assign(this, {
        checkedList_lang: e.target.checked ? this.plainOptions_lang : [],
        indeterminate_lang: false,
        checkAll_lang: e.target.checked
      })
    },
    onChange_precept (checkedList) {
      this.indeterminate_precept = !!checkedList.length && checkedList.length < this.plainOptions_precept.length
      this.checkAll_precept = checkedList.length === this.plainOptions_precept.length
    },
    onCheckAllChange_precept (e) {
      Object.assign(this, {
        checkedList_precept: e.target.checked ? this.plainOptions_precept : [],
        indeterminate_precept: false,
        checkAll_precept: e.target.checked
      })
    },
    onChange_selfcare (checkedList) {
      this.indeterminate_selfcare = !!checkedList.length && checkedList.length < this.plainOptions_selfcare.length
      this.checkAll_selfcare = checkedList.length === this.plainOptions_selfcare.length
    },
    onCheckAllChange_selfcare (e) {
      Object.assign(this, {
        checkedList_selfcare: e.target.checked ? this.plainOptions_selfcare : [],
        indeterminate_selfcare: false,
        checkAll_selfcare: e.target.checked
      })
    },
    onChange_imitation (checkedList) {
      this.indeterminate_imitation = !!checkedList.length && checkedList.length < this.plainOptions_imitation.length
      this.checkAll_imitation = checkedList.length === this.plainOptions_imitation.length
    },
    onCheckAllChange_imitation (e) {
      Object.assign(this, {
        checkedList_imitation: e.target.checked ? this.plainOptions_imitation : [],
        indeterminate_imitation: false,
        checkAll_imitation: e.target.checked
      })
    },
    onChange_grossmotor (checkedList) {
      this.indeterminate_grossmotor = !!checkedList.length && checkedList.length < this.plainOptions_grossmotor.length
      this.checkAll_grossmotor = checkedList.length === this.plainOptions_grossmotor.length
    },
    onCheckAllChange_grossmotor (e) {
      Object.assign(this, {
        checkedList_grossmotor: e.target.checked ? this.plainOptions_grossmotor : [],
        indeterminate_grossmotor: false,
        checkAll_grossmotor: e.target.checked
      })
    },
    onChange_finemotor (checkedList) {
      this.indeterminate_finemotor = !!checkedList.length && checkedList.length < this.plainOptions_finemotor.length
      this.checkAll_finemotor = checkedList.length === this.plainOptions_finemotor.length
    },
    onCheckAllChange_finemotor (e) {
      Object.assign(this, {
        checkedList_finemotor: e.target.checked ? this.plainOptions_finemotor : [],
        indeterminate_finemotor: false,
        checkAll_finemotor: e.target.checked
      })
    },
    onChangeAddress (value) {
      this.Address = value
      console.log(value)
    },
    loadDataNativePlace (value) {
      var params
      const targetOption = value[value.length - 1]
      if (targetOption) {
        targetOption.loading = true
        params = value[value.length - 1].value
        areaList({ parentID: params }).then(res => {
          var _options = []
          res.data.map(a => {
            _options.push({
              value: a.id,
              label: a.areaName,
              isLeaf: a.depth < 2 ? false : true
            })
          })
          targetOption.children = _options
          targetOption.loading = false
          this.options_nativePlace = [...this.options_nativePlace]
        })
      }
    },
    loadDataAddress (value) {
      var params
      const targetOption = value[value.length - 1]
      if (targetOption) {
        targetOption.loading = true
        params = value[value.length - 1].value
        areaList({ parentID: params }).then(res => {
          var _options = []
          res.data.map(a => {
            _options.push({
              value: a.id,
              label: a.areaName,
              isLeaf: a.depth < 2 ? false : true
            })
          })
          targetOption.children = _options
          targetOption.loading = false
          this.options_address = [...this.options_address]
        })
      }
    },
    initAreaList () {
      areaList({ parentID: 0 }).then(res => {
        var _options = []
        res.data.map(a => {
          _options.push({
            value: a.id,
            label: a.areaName,
            isLeaf: false
          })
        })
        this.options_address = _options
        this.options_nativePlace = _options
      })
    },
    setRowClassName (record, idx) {
      return idx % 2 == 1 ? 'bg-zebra-pattern' : ''
    },
    onSelectChange (selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys
    },
    handleSave (data, id) {
      this.DeclareSubsidyExs.push(Object.assign(data, { oid: moment().format('YYYYMMDDHHmmss') }))
    },
    handleAdd () {
      this.$refs.infomodal.add()
    },
    handleDel () {
      this.DeclareSubsidyExs = this.DeclareSubsidyExs.filter(a => this.selectedRowKeys.indexOf(a.oid) <= -1)
    },
    changeIsMediHistoryDurPreg (checked) {
      this.mediHistoryDurPregRequired = checked
    },
    changeIsMajorDiseasesHistory (checked) {
      this.majorDiseasesHistoryRequired = checked
    }
    // phoneCheck(rule, value, callbackFn) {
    //   const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
    //   if (!reg.test(value)) {
    //     callbackFn('请输入正确的手机号')
    //     return
    //   }
    //   callbackFn()
    // }
  },
  created () {
    getDictByCode({ categoryCode: dropValue.ClassType }).then(res => {
      this.SKDrop = res
    })
    getDictByCode({ categoryCode: dropValue.EscortType }).then(res => {
      this.PHDrop = res
    })
    getDictByCode({ categoryCode: dropValue.JTLX }).then(res => {
      this.JTLXDrop = res
    })
    getDictByCode({ categoryCode: dropValue.ZYDYR }).then(res => {
      this.ZYDYRDrop = res
    })
    getDictByCode({ categoryCode: dropValue.JZYCBS }).then(res => {
      this.JZYCBSDrop = res
    })
    getDictByCode({ categoryCode: dropValue.SFDX }).then(res => {
      this.SFDXDrop = res
    })
    getDictByCode({ categoryCode: dropValue.SMQK }).then(res => {
      this.SMQKDrop = res
    })
    getDictByCode({ categoryCode: dropValue.YSQK }).then(res => {
      this.YSQKDrop = res
    })
    getDictByCode({ categoryCode: dropValue.Ability }).then(res => {
      this.AbilityDrop = res
    })
    getDictByCode({ categoryCode: dropValue.socialSkills }).then(res => {
      this.socialSkillsDrop = res
      this.source = res.filter(a => a.ID != -1)
      this.plainOptions_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.languageAbility }).then(res => {
      this.languageAbilityDrop = res
      this.source_lang = res.filter(a => a.ID != -1)
      this.plainOptions_lang_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_lang = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.perceptualAbility }).then(res => {
      this.perceptualAbilityDrop = res
      this.source_precept = res.filter(a => a.ID != -1)
      this.plainOptions_precept_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_precept = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.selfCareAbility }).then(res => {
      this.selfCareAbilityDrop = res
      this.source_selfcare = res.filter(a => a.ID != -1)
      this.plainOptions_selfcare_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_selfcare = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.imitationAbility }).then(res => {
      this.imitationAbilityDrop = res
      this.source_imitation = res.filter(a => a.ID != -1)
      this.plainOptions_imitation_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_imitation = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.grossMotor }).then(res => {
      this.grossMotorDrop = res
      this.source_grossmotor = res.filter(a => a.ID != -1)
      this.plainOptions_grossmotor_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_grossmotor = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    getDictByCode({ categoryCode: dropValue.fineMotor }).then(res => {
      this.fineMotorDrop = res
      this.source_finemotor = res.filter(a => a.ID != -1)
      this.plainOptions_finemotor_value = res
        .filter(a => a.ID != -1)
        .map(data => {
          return null
        })
      this.plainOptions_finemotor = res
        .filter(a => a.ID != -1)
        .map(data => {
          return data.Title
        })
    })
    dropList({ categoryId: dropValue.Mz }).then(res => {
      this.MZDrop = res
    })
    dropList({ categoryId: dropValue.Wrx }).then(res => {
      this.WRXDrop = res
    })
    dropList({ categoryId: dropValue.zuyue }).then(res => {
      this.ZuyueDrop = res
    })
    dropList({ categoryId: dropValue.taici }).then(res => {
      this.TaiciDrop = res
    })
    dropList({ categoryId: dropValue.buru }).then(res => {
      this.BuruDrop = res
    })
    dropList({ categoryId: dropValue.fenmian }).then(res => {
      this.FenmianDrop = res
    })
    dropList({ categoryId: dropValue.huangdou }).then(res => {
      this.HuangdouDrop = res
    })
    dropList({ categoryId: dropValue.zhuyuan }).then(res => {
      this.ZhuyuanDrop = res
    })
    dropList({ categoryId: dropValue.shuangbaotai }).then(res => {
      this.ShuangbaotaiDrop = res
    })
    dropList({ categoryId: dropValue.fenmian }).then(res => {
      this.ShunchanDrop = res
    })
    dropList({ categoryId: dropValue.ZX }).then(res => {
      this.ZXDrop = res
    })
    this.initAreaList()
  },
  mounted () { }
}
</script>
<style lang="less" scoped>
.ant-card {
  /deep/.ant-card-small > .ant-card-body {
    padding: 0 12px;
  }
  /deep/.ant-card-head-wrapper {
    line-height: 16px;
  }
}
/deep/.ant-tabs-nav .ant-tabs-tab {
  font-size: 15px;
  font-weight: bold;
}
/deep/.ant-popover-inner-content {
  padding: 0;
}
.ant-form-item {
  margin-bottom: 4px;
}
.avatar-uploader > .ant-upload {
  width: 104px;
  height: 104px;
}
.ant-upload-list-picture-card-container {
  width: 104px;
  height: 104px;
}
.ant-upload-select-picture-card i {
  font-size: 32px;
  color: #999;
}

.ant-upload-select-picture-card .ant-upload-text {
  margin-top: 8px;
  color: #666;
}

.notclickn {
  pointer-events: none;
}
.spin-content {
  .ability {
    .checkbox {
      padding-bottom: 10px;
      .remark_input {
        margin-left: 10px;
        width: 180px;
      }
    }
    .checkbox2 {
      /deep/.ant-checkbox-group-item {
        display: block;
        margin-bottom: 5px;
      }
    }
    .title_top {
      color: @primary-color;
      font-weight: bold;
      font-size: 18px;
      margin-bottom: 10px;
    }
    .bottom_dash {
      border-bottom: 1px dashed #d6d5b7;
    }
    .right_dash {
      border-right: 1px dashed #d6d5b7;
    }
  }
  /deep/.ant-tabs .ant-tabs-left-bar .ant-tabs-ink-bar {
    height: 0px !important;
  }
  /deep/.ant-card-head {
    border-bottom: none;
  }
  /deep/.ant-tabs-nav .ant-tabs-tab-active {
    background-color: #3b5998;
    color: #ffffff;
  }
  /deep/.ant-tabs-nav .ant-tabs-tab:hover {
    background-color: #3b5998 !important;
  }
  .card_title {
    font-size: 15px;
    font-weight: 900;
    color: @primary-color;
  }
}
.viewless {
  /deep/.ant-input-group-addon {
    display: none;
  }
  /deep/.ant-input-number {
    border: none;
    background: transparent;
  }

  /deep/.ant-input {
    border: none;
    background: transparent;
  }

  .ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /deep/.ant-input-disabled {
    color: rgba(0, 0, 0, 0.65);
    cursor: default;
  }

  /deep/.ant-select-disabled {
    color: rgba(0, 0, 0, 0.65);
  }

  // /deep/.ant-modal-content {
  //   pointer-events: unset;
  // }
  /deep/.ant-select-selection--single {
    border: none;
    background: transparent;
  }

  /deep/.ant-select-arrow .ant-select-arrow-icon {
    display: none;
  }

  /deep/.anticon {
    display: none;
  }

  /deep/.vue-treeselect div,
  .vue-treeselect span {
    border: none;
  }

  /deep/.vue-treeselect__x-container {
    display: none;
  }

  /deep/.vue-treeselect__control-arrow-container {
    display: none;
  }
}
</style>
